<!--  -->
<template>
  <div class="list_module_title_content">
    <p class="list_module_title_text">{{ titleText }}</p>
    <span
      class="list_module_title_icon"
      v-show="showIcon"
      @click="addContent()"
    ></span>
  </div>
</template>

<script>
export default {
  props: {
    // listTitleObj: {
    titleText: {
      type: String,
      default: "",
      required: true,
    },
    showIcon: {
      type: Boolean,
      default: () => {
        return true;
      },
    },
    // },
  },
  data() {
    return {};
  },
  methods: {
    addContent() {
      let routeName = this.$route.path;
      //lzy 新增是否为‘生物剂’模块判断
      if(routeName == '/data/reagent/virus'){
        this.$router.push({path:'/data/reagent/virus/VirusAdd',query:{type:'virus'}});
      }else if(routeName == '/data/reagent/germ'){
        this.$router.push({path:'/data/reagent/germ/VirusAdd',query:{type:'germ'}});
      }else if(routeName == '/data/reagent/rickettsiite'){
        this.$router.push({path:'/data/reagent/rickettsiite/VirusAdd',query:{type:'rickettsiite'}});
      }else if(routeName == '/data/reagent/fungus'){
        this.$router.push({path:'/data/reagent/fungus/VirusAdd',query:{type:'fungus'}});
      }else if(routeName == '/data/reagent/poison'){
        this.$router.push({path:'/data/reagent/poison/VirusAdd',query:{type:'poison'}});
      }else{
        console.log(this.$route);
        this.$router.push({
          path: `${routeName}/add`,
        });
      }
    },
  },
};
</script>
<style  scoped>
.list_module_title_content {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  height: 56px;
  background-color: #f1f5f9;
  border-radius: 4px;
  margin-top: 4px;
}
.list_module_title_text {
  margin-left: 56px;
  letter-spacing: 2px;
  color: #868d95;
}
.list_module_title_icon {
  margin-right: 24px;
  width: 20px;
  height: 20px;
  background-repeat: no-repeat;
  background-size: cover;
  background-image: url(../../assets/image/add.png);
}
</style>